for the day when it's not a string pointer.
xfree(extra);
}
- if (!nourl && wpt->url) {
+ if (!nourl && wpt->hasLink()) {
int len = 7+strlen(wpt->url);
char* extra = (char*)xmalloc(len);
sprintf(extra, "{URL=%s}", wpt->url);
strcpy(buff, xcsv_urlbase);
off = strlen(xcsv_urlbase);
}
- if (wpt->url) {
+ if (wpt->hasLink()) {
snprintf(buff + off, sizeof(buff) - off, fmp->printfc, wpt->url);
} else {
strcpy(buff, (fmp->val && *fmp->val) ? fmp->val : "\"\"");
break;
case XT_URL_LINK_TEXT:
snprintf(buff, sizeof(buff), fmp->printfc,
- (wpt->url_link_text && *wpt->url_link_text) ? wpt->url_link_text : fmp->val);
+ (wpt->hasLinkText()) ? wpt->url_link_text : fmp->val);
break;
case XT_ICON_DESCR:
writebuff(buff, fmp->printfc,
* members must match struct url_link...
*/
url_link* url_next;
+ bool hasLink() const {return url && *url; }
+ bool hasLinkText() const {return url && *url; }
char* url;
char* url_link_text;
gbfputc(5, file_out);
gbfputpstr(wpt->notes, file_out);
}
- if (wpt->url_link_text) {
+ if (wpt->hasLinkText()) {
gbfputc(6, file_out);
gbfputpstr(wpt->url_link_text, file_out);
}
- if (1 && wpt->url) {
+ if (wpt->hasLink()) {
gbfputc(9, file_out);
gbfputcstr(wpt->url, file_out);
}
country = gt_get_icao_country(GMSD_GET(cc, ""));
print_string("%s\t", (country != NULL) ? country : "");
print_date_and_time(wpt->creation_time, 0);
- print_string("%s\t", wpt->url ? wpt->url : "");
+ print_string("%s\t", wpt->hasLink() ? wpt->url : "");
print_categories(GMSD_GET(category, 0));
gbfprintf(fout, "\r\n");
reclen = FREAD_i32;
i = FREAD(buf, reclen + 1);
if (global_opts.verbose_status > 0) {
- char* name = buf+2;
+ const char* name = buf+2;
if (strstr(name, "SQA") == 0) {
name = "MapSource";
} else if (strstr(name, "neaderhi") == 0) {
FWRITE_CSTR(str); /* instruction */
cnt = 0;
- if (wpt->url) {
+ if (wpt->hasLink()) {
cnt++;
}
for (url_next = wpt->url_next; (url_next); url_next = url_next->url_next)
cnt++;
}
FWRITE_i32(cnt);
- if (wpt->url) {
+ if (wpt->hasLink()) {
FWRITE_CSTR(wpt->url);
}
for (url_next = wpt->url_next; (url_next); url_next = url_next->url_next)
writer.writeTextElement("type", deficon ? deficon : waypointp->icon_descr);
- if (waypointp->url) {
+ if (waypointp->hasLink()) {
writer.writeStartElement("link");
writer.writeAttribute("text ", "Cache Details");
writer.writeCharacters(waypointp->url);
}
gbfprintf(file_out, "<br>\n");
if (strcmp(wpt->description, wpt->shortname)) {
- if (wpt->url) {
+ if (wpt->hasLink()) {
char* d = html_entitize(wpt->description);
gbfprintf(file_out, "<a href=\"%s\">%s</a>", wpt->url, d);
xfree(d);
xfree(p);
}
- if (waypointp->url_link_text) {
+ if (waypointp->hasLinkText()) {
p = xml_entitize(waypointp->url_link_text);
kml_write_xml(0, "<Data name=\"gc_name\"><value>%s</value></Data>\n", p);
xfree(p);
kml_write_xmle("name", waypointp->shortname);
// Description
- if (waypointp->url && waypointp->url[0]) {
+ if (waypointp->hasLink()) {
char* odesc = xml_entitize(waypointp->url);
kml_write_xml(0, "<snippet/>\n");
kml_write_xml(0, "<description>\n");
- if (waypointp->url_link_text && waypointp->url_link_text[0]) {
+ if (waypointp->hasLinkText()) {
char* olink = xml_entitize(waypointp->url_link_text);
kml_write_xml(0, "<![CDATA[<a href=\"%s\">%s</a>]]>", odesc, olink);
xfree(olink);
}
lmx_end_tag(0x4A, 3); // coordinates
- if (wpt->url && wpt->url[0]) {
+ if (wpt->hasLink()) {
lmx_start_tag(0x65, 3); // mediaLink
if (!binary) {
gbfputc('\n', ofd);
}
- if (wpt->url_link_text) {
+ if (wpt->hasLinkText()) {
lmx_write_xml(0x48, wpt->url_link_text, 4); // name
}
lmx_write_xml(0x67, wpt->url, 4); // url
wpt->notes = xstrdup(cend);
}
- if (wpt->url) {
+ if (wpt->hasLink()) {
DBG((sobj, "url = \"%s\"\n", wpt->url));
}
} else if (*str) {
if (wpt2->notes) {
wpt->notes = xstrdup(wpt2->notes);
}
- if (wpt2->url) {
+ if (wpt2->hasLink()) {
wpt->notes = xstrdup(wpt2->url);
}
gbfputuint16(0, fout); /* extra bytes */
}
- if (wpt->url && *wpt->url) {
+ if (wpt->hasLink()) {
str = xstrdup("_FILE_ ");
str = xstrappend(str, wpt->url);
str = xstrappend(str, "\n");
wpt->altitude,
colour,
icon,
- wpt->url ? wpt->url : ""
+ wpt->hasLink() ? wpt->url : ""
);
gb_setbit(&unicsv_outp_flags, fld_notes);
}
}
- if (wpt->url && *wpt->url) {
+ if (wpt->hasLink()) {
gb_setbit(&unicsv_outp_flags, fld_url);
}
if (wpt->creation_time != 0) {
gbfprintf(file_out, "N:%s;%s;;;\n", wpt->description,wpt->shortname);
gbfprintf(file_out, "ADR:%c%d %06.3f %c%d %06.3f\n", wpt->latitude < 0 ? 'S' : 'N', abs(latint), 60.0 * (fabs(wpt->latitude) - latint), wpt->longitude < 0 ? 'W' : 'E', abs(lonint), 60.0 * (fabs(wpt->longitude) - lonint));
- if (wpt->url) {
+ if (wpt->hasLink()) {
gbfprintf(file_out, "URL:%s\n", wpt->url);
}